import re

with open('kyj.txt','r',encoding='utf-8') as f:
    text = f.read()

result = re.findall('孔乙己',text,re.S)
result_iter = re.finditer('孔乙己',text,re.S)
for i in result_iter:
    print(i.group())
# print(result)
# print(len(result))

text = 'testesttestest'
result = re.findall('test',text)
print(result)
print(len(result))